<template>
  <div class="container blueinfo-detail clearfix">
    <div class="fl blueinfo-detail-left">
      <p class="blueinfo-detail-title">{{bluenewsdetail.title}}</p>
      <div class="clearfix blueinfo-detail-leftSmall">
        <p class="fl date">{{bluenewsdetail.updated_at}}</p>
        <p class="fr author">来源：<span>绿采</span></p>
      </div>
      <p class="content">{{bluenewsdetail.content}}
      </p>
    </div>
    <div class="fr blueinfo-detail-right">
      <img src="../../../static/images/img/lvcaiinfo-detail.png" alt="" class="infoimg-top">
      <p class="hotinfo">热门资讯</p>
      <ul class="hotinfo-list">
        <li v-for="(item,index) in bluenewsHotnews" :key="index" v-if="index<10" @click="toLvHotNewslist(item)">
          <a href="javascript:void(0);">{{item.title}}</a>
        </li>
      </ul>
      <img src="../../../static/images/img/lvcaiinfo-detail.png" alt="" class="infoimg-bottom">
    </div>
  </div>
</template>

<script>
import jquery from '../../assets/js/jquery-1.10.2.min.js'
import axios from 'axios'
export default {
  name:'Blueinfo_detail',
  data(){
    return{
      bluenewsdetail:{},
      bluenewsHotnews:[],
      bluenewslist:{},
      bluenewsLeftlist:{}
    }
  },
  methods:{
    // 绿色资讯-文字标题
    getBluenewsdetail () {
      debugger;
      var that=this
      axios.get('/article/detail')
      .then(function(res){
        res = res.data
        that.bluenewsdetail = res.response;
        that.bluenewsdetail.content = that.getContent(res.response.content)
      })
    },
    getContent(value){
      var str=value.replace(/<[^>]+>/g, ""); //去除数据中的HTML标签
      var neirong=str.replace("&nbsp;","");//将&nbsp标签换成空格
      var wenben=neirong.replace( /^\s*/, '');//将空格去除掉
      if(wenben.length>0){
          return wenben;
      }
      // if(wenben.length>16){
      //     return wenben.substr(0,15)+"......";
      // }else{
      //   return wenben;
      // }
    },
    // 咨询详情-右侧 热门资讯 正式环境   is_hot :1 
    getBluenewsHotnews () {
      debugger;
      var that=this
      axios.get('/article/list')
      .then(function(res){
        res = res.data
        that.bluenewsHotnews = res.response
      })
    },
    // 点击热门资讯进入详情
    toLvHotNewslist(item) {
      debugger;
      console.log(item)
      this.$router.push({
        name: 'Blueinfo_detail', params: {item: JSON.stringify(item)}
        //path:'/Blueinfo_detail/${item.id}',
        // query: {goodsList: goodsList}
        // 解决传过来的参数值在刷新页面后丢失
        //query: {item: JSON.stringify(item)}
      })
    }
  },
  created:function () {
    this.getBluenewsHotnews();
    this.getBluenewsdetail();
    this.$emit('public_header', false);
    this.$emit('public_headerhover', true);
    this.$emit('public_footer', true);
  },
  mounted(){
    // 解决传过来的参数值在刷新页面后丢失
    this.bluenewslist = JSON.parse(this.$route.params.bluenewsLeftlist)
  }
}
</script>

<style>
 @import '../../../static/style/blueinfo_detail';
</style>

